from flask import Flask,render_template,request
from bin import OpenDoor

app = Flask(__name__)

@app.route('/')
def index():
    return render_template(
        'index.html'
    )
@app.route('/open',methods=["POST"])
def open_first():
    door=request.form['door']
    res = OpenDoor.open_door(door)
    if 'error' in res:
        return render_template('res.html',no_message=res)
    else:
        return render_template('res.html',ok_message=res)


if __name__ == '__main__':
    app.run('0.0.0.0',8080,debug=True)
